<include file="public@header"/>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Plist/index')}">量化列表</a></li>
        <li><a href="{:url('Plist/add')}">添加量化</a></li>
    </ul>
        <form class="well form-inline margin-top-20" method="get"  action="{:url('Plist/index')}">
            学生姓名：
            <input type="text" class="form-control" value="{$Request.param.name}" name="name" style="width: 150px;"  placeholder="请输入学生姓名">
            原因:
            <select name="rid" class="form-control">
                <option value="">请选择科目</option>
                <foreach name="data" item="vo">
                    <option value="{$vo.reason.id}"<if $vo.reason.id == $Request.param.rid> selected </if>>{$vo.reason.reason}</option>
                </foreach>
            </select>
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('Plist/index')}">清空</a>
        </form>
    <form  method="post" class="margin-top-20" action="{:url('Plist/delAll')}">
        <button class="btn btn-xs btn-danger" onclick="delCheck()">批量删除</button>
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>
                    <input type="checkbox" onclick="checkAll(this)">
                </th>
                <th>ID</th>
                <th>学生姓名</th>
                <th>增/减分原因</th>
                <th>增/减分详情</th>
                <th>分值</th>
                <th>{:lang('STATUS')}</th>
                <th>操作人</th>
                <th>添加时间</th>
                <th>审核时间</th>
                <th>审核</th>
                <th>审核人</th>
                <th>{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="data" item="vo">
                <tr>
                    <td>
                    <input type="checkbox" name="ids[]" value="{$vo.id}" >
                    </td>
                    <td>{$key + 1}</td>
                    <td>
                    <a href="javascript:parent.openIframeLayer('{:url('Plist/score2')}?sid={$vo.sid}')">
                        {$vo.student.name}
                    </a>
                    </td>
                    <td>{$vo.reason.reason}</td>
                    <td>{$vo.desc}</td>
                    <td>{$vo.point.score}</td>
                    <td>
                        <switch name="$vo.Status">
                            <case value="1"> <button type="button" class="label label-success">已通过</button> </case>
                            <case value="2"> <button type="button" class="label label-danger">未通过</button> </case>
                            <case value="0"> <button type="button" class="label label-info">审核中</button> </case>

                        </switch>
                    </td>
                    <td>{$vo.user.user_login}</td>
                    <td>{$vo.Create_time|date='Y-m-d H:i:s'}</td>
                    <td>
                        <if $vo.Examine_time == 0>
                            未出理
                        <else/>
                            {$vo.Examine_time}
                        </if>
                       </td>
                    <td>
                        <switch name="$vo.Status">
                            <case value="0">
                                <a href="{:url('Plist/check',array('id' => $vo['id'],'type' => 1))}" type="button" class="label label-success js-ajax-dialog-btn" >通过</a>
                                <a href="{:url('Plist/check',array('id' => $vo['id'],'type' => 2))}" type="button" class="label label-danger js-ajax-dialog-btn" >不通过</a>
                            </case>
                        </switch>
                    </td>
                    <td>{$vo.admin.user_login}</td>
                    <td>
                        <a class="btn btn-xs btn-primary" href="{:url('Plist/add')}">添加</a>
                        <a class="btn btn-xs btn-success"  href="{:url('Plist/edit')}?id={$vo.id}">{:lang('EDIT')}</a>
                        <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Plist/delete')}?id={$vo.id}">{:lang('DELETE')}</a>
                    </td>
                </tr>
            </foreach>
            </tbody>

        </table>
        <div class="pagination" style = "margin-left:500px">
            <div class="pagination" >
                {$page}
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    //全选
    function checkAll(e) {
        var item = document.getElementsByName('ids[]');
        for (var i = 0; i < item.length; i++)
        {
            item[i].checked = e.checked;
        }
    }
    //全选删除
    function delCheck() {
        var isCheck = false;
        var item = document.getElementsByName('ids[]');
        for (var i = 0; i < item.length; i++)
        {
            if (item[i].checked)
            {
                isCheck = true;
            }
        }
        if (isCheck)
        {
            return confirm('确定删除吗？');
        } else {
            alert('请至少选择一项！');
            // layer.msg('请至少选择一项');
            return false;
        }
    }



</script>
</body>
</html>